#include<stdio.h>
#include<stdlib.h>

typedef struct head
{
    int n;
    struct numbers *next;
}head;

typedef struct numbers
{
    int data;
    struct numbers *next;
}numbers;

head *Create()
{
    head *h;
    numbers *p;
    numbers *t;

    p=(numbers*)malloc(sizeof(numbers*));
    h=(head*)malloc(sizeof(head*));

    while (1)
    {
        scanf("%d",&p->data);
        if (p->data == -1) {break;}
        p->next=NULL;

        if (h->n == 0)
        {
            h->next=p;        
        }
        else t->next=p;
        t=p;
        p=(numbers*)malloc(sizeof(numbers*));
        h->n++;
    }
    
    return h;
}

head *Delect(head* h)
{
    head *h1;
    numbers *p,*t;
    t=(numbers*)malloc(sizeof(numbers*));
    h1=(head*)malloc(sizeof(head*));
    p=(numbers*)malloc(sizeof(numbers*));
    h1->n=0;
    t = h->next;

    for (int i = 0; i < h->n; i++)
    {
        if (t->data%2==0)
        {
            if (h1->n == 0)
            {
                h1->next = t;
            }
            else p->next = t;
            p = t;
            h1->n++;
        }
        t = t->next;
    }
    
    return h1;
}

int main(void)
{
    int n;
    scanf("%d",&n);

    for (int i = 0; i < n; i++)
    {
        head *h;
        numbers *num;

        h = Delect(Create());
        if (h->n == 0)
        {
            printf("NULL\n");
            continue;
        }
        for (int i = 0; i < h->n; i++)
        {
            if (i == 0)
            {
                printf("%d ",h->next->data);
                num = h->next->next;
            }
            else
            {
                printf("%d ",num->data);
                num = num->next;
            }
            
        }
        printf("\n");
    }
    
}
